<?php

require $this->website['path']['action'] . '/admin/islogin.php';

$json = array('status' => 'error', 'msg' => 'ok', 'data' => '');

$configura = fn_post('configura');
$k = fn_post('k');

if ($configura && json_decode($configura, 1)) {

	if (!$this->website['class']['db']
		->table('configura')
		->where('k=?', $k)
		->count()) {
		$bool = $this->website['class']['db']
			->table('configura')
			->field('k', 'v')
			->value($k, $configura)
			->insert();
	} else {
		$bool = $this->website['class']['db']
			->table('configura')
			->field('v')
			->value($configura)
			->where('k=?', $k)
			->update();
	}

	$json['status'] = 'ok';
	$json['data'] = $bool;
	$json['msg'] = '保存成功';
} else {
	$json['msg'] = '保存配置失败';
}
// $json['sql'] = $this->website['class']['db']->sql;
$this->json_encode($json);